/*
 * Wazuh databaseFeedManager
 * Copyright (C) 2015, Wazuh Inc.
 * September 26, 2023.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */
#ifndef _TRAMPOLINE_ROUTERSUBSCRIBER_HPP
#define _TRAMPOLINE_ROUTERSUBSCRIBER_HPP

#include "MockRouterSubscriber.hpp"

#include <functional>
#include <memory>
#include <string>
#include <vector>

extern std::shared_ptr<MockRouterSubscriber> spRouterSubscriberMock;

/**
 * @brief This class is a wrapper of the trampoline router subscriber library.
 */
class TrampolineRouterSubscriber final
{
public:
    /**
     * @brief Constructor for creating a TrampolineRouterSubscriber object.
     *
     * The `TrampolineRouterSubscriber` constructor initializes a new instance of the
     * TrampolineRouterSubscriber class.
     *
     * @param topicName The name of the topic associated with this subscriber.
     * @param subscriberId Additional parameters provided as a string.
     * @param isLocal Enable if local or not, default true.
     */
    TrampolineRouterSubscriber(std::string topicName, std::string subscriberId, const bool isLocal = true) {};

    virtual ~TrampolineRouterSubscriber() = default;

    /**
     * @brief Adds subscriber to the list.
     *
     * @param callback Subscriber update callback.
     */
    void subscribe(const std::function<void(const std::vector<char>&)>& callback)
    {
        spRouterSubscriberMock->subscribe(callback);
    }
};

#endif //_TRAMPOLINE_ROUTERSUBSCRIBER_HPP
